package model;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "ChiTietDichGia_Sach")
public class ChiTietDichGia_Sach {
	private ChiTietDichGia_SachID chiTietDichGia_SachID;
	private Sach sach;
	private DichGia dichGia;
	public ChiTietDichGia_Sach(){
		
	}
	public ChiTietDichGia_Sach(ChiTietDichGia_SachID chiTietDichGia_SachID,
			Sach sach, DichGia dichGia) {
		super();
		this.chiTietDichGia_SachID = chiTietDichGia_SachID;
		this.sach = sach;
		this.dichGia = dichGia;
	}
	public ChiTietDichGia_Sach(ChiTietDichGia_SachID chiTietDichGia_SachID) {
		super();
		this.chiTietDichGia_SachID = chiTietDichGia_SachID;
	}


	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "ID_Sach", column = @Column(name = "ID_Sach", nullable = false)),
			@AttributeOverride(name = "ID_DichGia", column = @Column(name = "ID_DichGia", nullable = false)) })
	public ChiTietDichGia_SachID getChiTietDichGia_SachID() {
		return chiTietDichGia_SachID;
	}

	public void setChiTietDichGia_SachID(
			ChiTietDichGia_SachID chiTietDichGia_SachID) {
		this.chiTietDichGia_SachID = chiTietDichGia_SachID;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_Sach", nullable = false, insertable = false, updatable = false)
	public Sach getSach() {
		return sach;
	}

	public void setSach(Sach sach) {
		this.sach = sach;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_DichGia", nullable = false, insertable = false, updatable = false)
	public DichGia getDichGia() {
		return dichGia;
	}

	public void setDichGia(DichGia dichGia) {
		this.dichGia = dichGia;
	}

}
